import lexer.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        String inputPath;
        try {
            inputPath = args[0];
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("需要一个参数，请输入测试文件名作为参数运行");
            return;
        }
        Lexer l = new Lexer(inputPath);
        System.out.println(l.results);
        try {
            File writeName = new File("output.txt"); 
            writeName.createNewFile(); 
            try (FileWriter writer = new FileWriter(writeName); BufferedWriter out = new BufferedWriter(writer)) {
                for (AbstractTocken item : l.results) {
                    writer.write(item.toString() + "\n");
                }
                out.flush();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}